<script setup lang="ts">
import { IconError } from '@computing/opendesign-icons';
</script>

<template>
  <span class="icon-error-solid-box">
    <!-- 该图标中间的x是透明的，在表单校验失败时，会展示背景浅红色，用一个白色辅助盒子把x后面部分遮住，这样x看起来就是白色的 -->
    <span class="auxiliary-box"></span>
    <IconError class="icon-error-solid" />
  </span>
</template>

<style lang="scss" scoped>
.icon-error-solid-box {
  border-radius: 50%;
  display: inline-block;
  width: 16px;
  height: 16px;
  position: relative;
  opacity: 0;

  .auxiliary-box {
    position: absolute;
    z-index: 1;
    left: 2px;
    top: 2px;
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #fff;
    border-radius: 50%;
  }

  :deep(.icon-error-solid) {
    position: absolute;
    z-index: 2;
    left: 0;
    top: 0;
    font-size: 16px;
  }
}
</style>
